****************************************************************************
* File-Name: 		codes.do
* Date:		 07/07/2020
* Author: 		Fred Batista
* Purpose: 		Analysis of Brazilian Electoral Study (2010) for paper �Prejudice, Information, and the Vote for Women in Personalized PR Systems: Evidence from Brazil� (forthcoming in Journal of Women, Politics & Policy)
* Data used: 		ESEB2010.dta
* Data Output:	None	*/
****************************************************************************


***RECODING VARIABLES

*** Control variables

* sorting dataset

sort nquest

* state of residency

gen state = ESTADO

label variable state "State of residency"

* dummies for states (for fixed effects in models)

tab state, gen(state)

* urban residency

gen urban = 2 - ZONA

label variable urban "Resid�ncia urbana =1 (rural=0)"

* woman

gen woman = SEXO - 1

label variable woman "Woman"

* age

gen age = IDADE

label variable age "Age"

gen age01 = (age - 17)/76

* education (transforming level in years of education)

gen education = ESC

recode education (1=0) (2=2) (3=4) (4=6) (5=8) (6=9.5) (7=11) (8=13) (9=15) (10=18)

label variable education "Years of education (from degree of education)"

gen education01 = education/18

* whether respondent works outside of home

gen jobmarket = SITUPROF

recode jobmarket (1/8 10=1) (else=0)

label variable jobmarket "Works outside home (SITUPROF recode)"

* Family income (less missing cases than personal income)

gen income = RENDAF

label variable income "Family income"

gen income_2 = income/510

label variable income_2 "Family income in minimum wages"

gen income01 = (income - 50)/14950

* campaign awareness

gen campaign = v82

recode campaign (5 6=.) (4=0) (3=1) (2=2) (1=3) 

label variable campaign "Campaign awareness"

gen campaign01 = campaign/3

* perceived ambiguity

*gen amb_party = v80

*replace amb_party = . if amb_party==4 | amb_party==5

*replace amb_party = (amb_party - 1)/2

*gen amb_cand = v81

*replace amb_cand = . if amb_cand==4 | amb_cand==5

*replace amb_cand = (amb_cand- 1)/2

*recode v37 v38 (6 7=.)

*gen whogoverns = (v37-1)/4

*gen efficacy = (v38 - 1)/4

*gen ambiguity1 = (amb_cand + amb_party)/2

*gen ambiguity2 = (amb_cand + amb_party + whogoverns + efficacy)/4


* Newspaper reading

gen newspaper = v224

recode newspaper (.=0) (6=.) (4=1) (3=2) (2=3) (1=4)

label variable newspaper "Newspaper reading"

gen newspaper01 = newspaper/4

* race (dummies for white, brown, and black)

gen white = COR

recode white (1=1) (else=0)

gen black = COR

recode black (2=1) (else=0)

gen brown = COR

recode brown (3=1) (else=0)

* relgion (dummies for evangelical and catholic)

gen evangelical = RELIGI

recode evangelical (2 3=1) (else=0)

gen catholic = RELIGI

recode catholic (8=1) (else=0)


*** Attitudes and opinions (potentially related to the vote choice)

* if respondent is partisan

gen partisan = v40

recode partisan (1=1) (2 3=0) (4=.)

label variable partisan "Respondent identifies with a party (recode q40)"

* party preference (nominal)

gen partisanship = v41

recode partisanship (.=0) (29 30=0) (4 =5 ) (8=4) (1=3) (14=2) (else=1)

label define partisanshipl 0 "Nenhum" 1 "Outhers" 2 "PV" 3 "PMDB" 4 "PSDB" 5 "PT"

label values partisanship partisanshipl

* dummies for party ids

gen idpt = partisanship

recode idpt (5=1) (else=0)

gen idpsdb = partisanship

recode idpsdb (4=1) (else=0)

gen idpv = partisanship

recode idpv (2=1) (else=0)

* if respondents believes that president should identify with a party 

gen presparty = v165

recode presparty (1=1) (else=0)

label variable presparty "Resp thinks president should identify with a party"

* whether respondent locates herself in left-right scale

gen ideology = v79

recode ideology (0/10 = 1) (else=0)

label variable ideology "whether respondent locates herself in left-right scale"

* dummies for left, center, right

gen left = v79

recode left (0 1 2 3=1) (else=0)

label variable left "Left = 0, 1, 2 or 3"

gen center = v79

recode center (4 5 6=1) (else=0)

label variable center "Center = 4, 5 or 6"

gen right = v79

recode right (7 8 9 10=1) (else=0)

label variable right "Right = 7, 8, 9 or 10"


* economic evaluations

gen sociotropic = v234

recode sociotropic (1=4) (2=3) (3=2) (4=1) (5=0) (6=.)

label variable sociotropic "Sociotropic economic evaluation"

gen sociotropic01 = sociotropic/4

gen socioretro = v235

recode socioretro (1=2) (2=1) (3=0) (4=.)

label variable socioretro "Retrospective sociotropic economic evaluation"

gen socioretro01 = socioretro/2

gen pocketbook= v236

recode pocketbook (1=4) (2=3) (3=2) (4=1) (5=0) (6=.)

label variable pocketbook "Pocketbook economic evaluation"

gen pocketbook01 = pocketbook/4

gen pocketretro = v237

recode pocketretro (1=2) (2=1) (3=0) (4=.)

label variable pocketretro "Retrospective pocketbook economic evaluation"

gen pocketretro01 = pocketretro/2

* recipient of social programs

gen program1 = v241

gen program2 = v242

gen program3 = v243

gen program4 = v244

recode program1 program2 program3 program4 (1=1) (2=0) (3=.)

gen partprogram = program1 + program2 + program3 + program4

recode partprogram (0=0) (1 2 3 4=1)

label variable partprogram "Recipient of social program"


* Opinions about women in politics

gen career = v249

gen bettergov = v250

gen womenexp = v251

recode career better womenexp (1=0) (2=1) (5=2) (3=3) (4=4)

label variable career "Men better suited for political career"

label variable bettergov "Men govern better

label variable womenexp "Women less political experienced"

tab career [aweight=pesopop]

tab bettergov [aweight=pesopop]

tab womenexp [aweight=pesopop]

polychoric career bettergov womenexp

gen sexism = (career + womenexp + bettergov)/3

label variable sexism "Additive scale of sexism"

gen sexism01 = sexism/4

factormat r(R), factor(1) ml n(2000) 

factor career womenexp bettergov, ml factor(1)

predict fsexism

summarize fsexism

replace fsexism = (fsexism - r(min))/(r(max)-r(min))

label variable fsexism "Factor scores of sexism from 0 to 1"

* codify reasons (v214, v215):

tab v213 [aweight=pesopop]

gen womenmajoritarian = 2 - v213


**** vote choice

* vote first round

gen vote1 = v86

recode vote1 (1=3) (4=2) (6=1) (2 3 7 8=.) (10 11 12 13=.)

label define vote1l 1 "Marina" 2 "Serra" 3 "Dilma"

label values vote1 vote1l

label variable vote1 "Vote in 1st round (non voters and voters for other excluded, very small group)"

gen vote_fem1 = v86

recode vote_fem1 (1 6=1) (.=.) (12 13=.) (else=0)

gen select_vote_fem1 = vote_fem1

recode select_vote_fem1 (1 0 =1) (.=0)

* vote runoff

gen vote2 = v96

recode vote2 (1=1) (2=0) (else=.)

label define vote2l 1 "Dilma" 0 "Serra"

label values vote2 vote2l

label variable vote2 "Vote 2nd round"

* voted for a woman for state representative

recode v124 (39 48 52 68 72 79 82 85 91 103 108115 123 128 139 143 149 164 170 171 193 205 206 208 243 247 249 264 270 279 286 342 349 370 388 396 417 420 438 445 447 450 468 469 502 507 517 525 533 543 545 551 560 589 619 622 624 643 673 674 697 698 704 708 709 710 711 712 714 722 724 744=1) (97 173 185 212 299 340 375 376 471 559 727 759=-1) (.=-1) (else=0), gen(vfemest)

label variable vfemest "Voted for a women for state representativel"

recode v124 (97 173 185 212 299 340 375 376=.) (471 559 727 759=0) (.=0) (else=1), gen(select_vfemest)

label variable select_vfemest"Selection to vfemest"


* voted for a woman for House of Represesntatives

recode v116 (13 84 90 94 114 119 125 126 130 132 153 161 174 182 183 194 201 225 232 233 259 281 286 309 312 313 323 329 371 381 408 439 444 474 491 495 496 508 526 536 563 572 580 591 598 615 622 625 641 646 678=1) (73  162 198 210 349 455 539 557 675 693 694=-1) (.=-1) (else=0), gen (vfemfed)

label variable vfemfed "voted for a woman for House"

recode v116 (693 694=0) (.=0) (73  162 198 210 349 455 539 557 675=.) (else=1), gen(select_vfemfed)

label variable select_vfemfed "Selection to vfemfed"

* Voted for a woman for Senate

* first choice

recode v106 (12 32 41 47 50 54 71 76 110 121 191 192 193 200 202 207 214 218 222 231 237=1) (39 262 263=-1) (.=-1) (else=0), gen(vfemsen1)

label variable vfemsen1 "Voted for a woman for Senate first choice"

recode v106 (262 263=0) (.=0) (39=.) (else=1), gen(select_vfemsen1)

label variable select_vfemsen1 "Selection to vfemsen1"

* second choice

recode v107 (12 32 47 66 71 76 82 110 136 191 192 193 200 209 214 231 237=1) (262 264=-1) (.=-1) (else=0), gen(vfemsen2)

label variable vfemsen2 "Voted for a woman for Senate second choice"

recode v106 (262 263=0) (.=0) (else=1), gen(select_vfemsen2)

label variable select_vfemsen2 "Selection to vfemsen2"

* multinomial vote for woman for senate

gen vfemsen=.
replace vfemsen=2 if vfemsen1==1 & vfemsen2==0
replace vfemsen=1 if vfemsen1==0 & vfemsen2==1
replace vfemsen=0 if vfemsen1==0 & vfemsen2==0

label variable vfemsen "Vote for woman for Senate first and second choices"

*any vote for woman for senate

gen vfemsen_any=. if vfemsen1==-1 & vfemsen2==-1
replace vfemsen_any=1 if vfemsen1==1
replace vfemsen_any=1 if vfemsen2==1
replace vfemsen_any=0 if vfemsen1==0 & vfemsen2==0

label variable vfemsen_any "Vote for any woman for Senate"

gen select_vfemsen_any=vfemsen_any
recode select_vfemsen_any (0 1=1) (.=0)

label variable select_vfemsen_any "Selection to vfemsen_any"


* Vote for a woman for state governor

recode v97 (41 45 58 75 107 120 122 132 144 147 152=1) (169 170 171 172 =-1) (.=-1) (else=0), gen(vfemgov)

label variable vfemgov "Vote for a woman for state governor"

gen select_vfemgov=vfemgov
recode select_vfemgov(-1=0) (0 1=1) (.=0)

label variable select_vfemgov"Selection to vfemgov"


**States with women running for governor:
*Cear� (2), Distrito Federal, Esp�rito Santo, Goi�s, Maranh�o, Minas Gerais (2), Par�, Para�ba, Piau�, Rio Grande do Norte (2), Rio Grande do Sul, Santa Catarina (2), S�o Paulo, Sergipe (2).

recode ESTADO (6 7 8 9 10 13 14 16 18 20 21 24 25 26=1) (else=0), gen(womengov)

label variable womengov "State has women running for governor"

**States with women running for senate:
*Alagoas, Amazonas, Bahia, Cear�, Distrito Federal, Esp�rto Santo, Goi�s, Maranh�o, Minas Gerais, Par�, Paran�, Pernambuco, Piau�, Rio Grande do Norte, Rio Grande do Sul, Rond�nia, Roraima, Santa Catarina, S�o Paulo, Sergipe.

recode ESTADO (2 4 5 6 7 8 9 10 13 16 15 17 18 20 21 22 23 24 25 26=1) (else=0), gen(womensen)

label variable womensen "State has women running for senate"

**States with 2 women running for senate:

recode ESTADO (4 5 6 17 21 23 26=1) (else=0), gen(womensen2)

label variable womensen2 "State has 2 women running for senate"


* States with larger samples

recode ESTADO (5 13 15 19 21 26=1) (else=0), gen(bigstate)

label variable bigstate "States with larger samples (n>100)�

recode ESTADO (2 5 6 8 9 10 11 13 14 15 16 17 18 19 20 21 24 26=1) (else=0), gen(bigstate2)

label variable bigstate2 "States with larger samples (n>30)�


*** Information

* True of False battery

gen partyalck = v171

gen majoritarian = v173

recode partyalck majoritarian (2=1) (1 3=0) (4=.)

gen mandate = v172

gen partylula = v174

recode mandate partylula (1=1) (2 3=0) (4=.)

* party of leaders battery

gen partaecio = v175

recode partaecio (8=1) (else=0)

gen partmercadante = v176

recode partmercadante (4=1) (else=0)

gen partciro = v177

recode partciro (7=1) (else=0)

gen partsuplicy = v178

recode partsuplicy (4=1) (else=0)

gen partfhc = v179

recode partfhc (8=1) (else=0)

gen partitamar = v180

recode partitamar (1=1) (else=0)

gen partbornhausen = v181

recode partbornhausen (5=1) (else=0)

gen partanibal = v182

recode partanibal (8=1) (else=0)

gen partdirceu = v183

recode partdirceu (4=1) (else=0)

gen partsarney = v184

recode partsarney (1=1) (else=0)

gen partserra = v185

recode partserra (8=1) (else=0)

gen partlula = v186

recode partlula (4=1) (else=0)

gen partmaciel = v187

recode partmaciel (5=1) (else=0)

gen partmarina = v188

recode partmarina (14=1) (else=0)

gen parttemer = v189

recode parttemer (1=1) (else=0)

gen partsimon = v190

recode partsimon (1=1) (else=0)

gen partroseana = v191

recode partroseana (1=1) (else=0)

* dimensionality analysis (partylula, partciro e partbornhausen removed to colinearity)

tetrachoric partyalck majoritarian mandate partylula partaecio partmercadante partciro partsuplicy partfhc partitamar partbornhausen partanibal partdirceu partsarney partserra partlula partmaciel partmarina parttemer partsimon partroseana, posdef

factormat r(Rho), factor(1) ml n(1993)

* generating additive scale

gen information01 = (partyalck + majoritari + mandate + partylula)/4

label variable information01 "Additive scale of political information"

gen information2 = (partyalck + majoritari + mandate + partylula + partaecio + partmercadante + partciro + partsuplicy + partfhc + partitamar + partbornhausen + partanibal + partdirceu + partsarney + partserra + partlula + partmaciel + partmarina + parttemer + partsimon + partroseana)

gen information01_2 = information2/21

summarize partyalck majoritarian mandate partylula [aweight=pesopop]

tetrachoric partyalck majoritarian mandate partylula, posdef

factormat r(Rho), factor(1) ml n(1993)

reg information01 campaign01 newspaper01 urban education01 jobmarket woman age01 i.state [pweight=pesopop]

factor partyalck majoritari mandate partylula, factor(1) ml

predict finfo

summarize finfo

generate finfo01 = (finfo - r(min))/(r(max)-r(min))

factor partyalck majoritarian mandate partylula partaecio partmercadante partciro partsuplicy partfhc partitamar partbornhausen partanibal partdirceu partsarney partserra partlula partmaciel partmarina parttemer partsimon partroseana, factor(1) ml

predict finfo2

summarize finfo2

generate finfo01_2 = (finfo2 - r(min))/(r(max)-r(min))


***** state-level variables

* district  magnitude (number of seats) for Chamber

gen dismag_fed =.
replace dismag_fed=8  if state ==1
replace dismag_fed=9  if state ==2
replace dismag_fed=8  if state ==3
replace dismag_fed=8  if state ==4
replace dismag_fed=39  if state ==5
replace dismag_fed=22  if state ==6
replace dismag_fed=8  if state ==7
replace dismag_fed=10  if state ==8
replace dismag_fed=17  if state ==9
replace dismag_fed=18  if state ==10
replace dismag_fed=8  if state ==11
replace dismag_fed=8  if state ==12
replace dismag_fed=53  if state ==13
replace dismag_fed=12  if state ==14
replace dismag_fed=30  if state ==15
replace dismag_fed=17  if state ==16
replace dismag_fed=25  if state ==17
replace dismag_fed=10  if state ==18
replace dismag_fed=46  if state ==19
replace dismag_fed=8  if state ==20
replace dismag_fed=31  if state ==21
replace dismag_fed=8  if state ==22
replace dismag_fed=8  if state ==23
replace dismag_fed=16  if state ==24
replace dismag_fed=8  if state ==25
replace dismag_fed=70  if state ==26
replace dismag_fed=8  if state ==27

gen dismag_fed01 = (dismag_fed - 8)/62

* district  magnitude (number of seats) for State Chamber

gen dismag_est =.
replace dismag_est=24  if state ==1
replace dismag_est=27  if state ==2
replace dismag_est=22  if state ==3
replace dismag_est=24  if state ==4
replace dismag_est=63  if state ==5
replace dismag_est=46  if state ==6
replace dismag_est=24  if state ==7
replace dismag_est=30  if state ==8
replace dismag_est=41  if state ==9
replace dismag_est=42  if state ==10
replace dismag_est=24  if state ==11
replace dismag_est=24  if state ==12
replace dismag_est=78  if state ==13
replace dismag_est=36  if state ==14
replace dismag_est=54  if state ==15
replace dismag_est=41  if state ==16
replace dismag_est=49  if state ==17
replace dismag_est=30  if state ==18
replace dismag_est=71  if state ==19
replace dismag_est=24  if state ==20
replace dismag_est=55  if state ==21
replace dismag_est=24  if state ==22
replace dismag_est=24  if state ==23
replace dismag_est=40  if state ==24
replace dismag_est=24  if state ==25
replace dismag_est=94  if state ==26
replace dismag_est=25  if state ==27

gen dismag_est01 = (dismag_est - 22)/72

* per capita gdp

gen gdppc =.
replace gdppc=15098.13 if state==1
replace gdppc=7874.21 if state==2
replace gdppc=12361.45 if state==3
replace gdppc=17173.33 if state==4
replace gdppc=11007.47 if state==5
replace gdppc=9216.96 if state==6
replace gdppc=58489.46 if state==7
replace gdppc=23378.74 if state==8
replace gdppc=16251.70 if state==9
replace gdppc=6888.60 if state==10
replace gdppc=19644.09 if state==11
replace gdppc=17765.68 if state==12
replace gdppc=17931.89 if state==13
replace gdppc=8481.14 if state==14
replace gdppc=20813.98 if state==15
replace gdppc=10259.20 if state==16
replace gdppc=10821.55 if state==17
replace gdppc=7072.80 if state==18
replace gdppc=25455.38 if state==19
replace gdppc=10207.56 if state==20
replace gdppc=23606.36 if state==21
replace gdppc=15098.13 if state==22
replace gdppc=14051.91 if state==23
replace gdppc=24398.42 if state==24
replace gdppc=11572.44 if state==25
replace gdppc=30243.17 if state==26
replace gdppc=12461.67 if state==27

summarize gdppc

gen gdppc01 = (gdppc - r(min))/(r(max) - r(min))

* tot_cand_fed

gen tot_cand_fed =.
replace tot_cand_fed = 37 if state == 1
replace tot_cand_fed = 64 if state == 2
replace tot_cand_fed = 51 if state == 3
replace tot_cand_fed = 74 if state == 4
replace tot_cand_fed = 243 if state == 5
replace tot_cand_fed = 114 if state == 6
replace tot_cand_fed = 94 if state == 7
replace tot_cand_fed = 72 if state == 8
replace tot_cand_fed = 119 if state == 9
replace tot_cand_fed = 150 if state == 10
replace tot_cand_fed = 524 if state == 11
replace tot_cand_fed = 67 if state == 12
replace tot_cand_fed = 68 if state == 13
replace tot_cand_fed = 118 if state == 14
replace tot_cand_fed = 77 if state == 15
replace tot_cand_fed = 176 if state == 16
replace tot_cand_fed = 87 if state == 17
replace tot_cand_fed = 265 if state == 18
replace tot_cand_fed = 753 if state == 19
replace tot_cand_fed = 60 if state == 20
replace tot_cand_fed = 71 if state == 21
replace tot_cand_fed = 62 if state == 22
replace tot_cand_fed = 271 if state == 23
replace tot_cand_fed = 147 if state == 24
replace tot_cand_fed = 54 if state == 25
replace tot_cand_fed = 1030 if state == 26
replace tot_cand_fed = 40 if state == 27

summarize tot_cand_fed

gen tot_cand_fed01 = (tot_cand_fed - r(min))/(r(max) - r(min))

gen ln_tot_cand_fed = ln(tot_cand_fed)

summarize ln_tot_cand_fed

gen ln_tot_cand_fed01 = (ln_tot_cand_fed - r(min))/(r(max) - r(min))



* tot_cand_fed_nl

gen tot_cand_fed_nl =.
replace tot_cand_fed_nl = 34 if state == 1
replace tot_cand_fed_nl = 50 if state == 2
replace tot_cand_fed_nl = 28 if state == 3
replace tot_cand_fed_nl = 66 if state == 4
replace tot_cand_fed_nl = 201 if state == 5
replace tot_cand_fed_nl = 77 if state == 6
replace tot_cand_fed_nl = 63 if state == 7
replace tot_cand_fed_nl = 66 if state == 8
replace tot_cand_fed_nl = 77 if state == 9
replace tot_cand_fed_nl = 141 if state == 10
replace tot_cand_fed_nl = 422 if state == 11
replace tot_cand_fed_nl = 52 if state == 12
replace tot_cand_fed_nl = 51 if state == 13
replace tot_cand_fed_nl = 92 if state == 14
replace tot_cand_fed_nl = 53 if state == 15
replace tot_cand_fed_nl = 132 if state == 16
replace tot_cand_fed_nl = 49 if state == 17
replace tot_cand_fed_nl = 211 if state == 18
replace tot_cand_fed_nl = 698 if state == 19
replace tot_cand_fed_nl = 45 if state == 20
replace tot_cand_fed_nl = 68 if state == 21
replace tot_cand_fed_nl = 52 if state == 22
replace tot_cand_fed_nl = 230 if state == 23
replace tot_cand_fed_nl = 111 if state == 24
replace tot_cand_fed_nl = 47 if state == 25
replace tot_cand_fed_nl = 772 if state == 26
replace tot_cand_fed_nl = 33 if state == 27

summarize tot_cand_fed_nl

gen tot_cand_fed_nl01 = (tot_cand_fed_nl - r(min))/(r(max) - r(min))

gen ln_tot_cand_fed_nl = ln(tot_cand_fed_nl)

summarize ln_tot_cand_fed_nl

gen ln_tot_cand_fed_nl01 = (ln_tot_cand_fed_nl - r(min))/(r(max) - r(min))


* prop_fcand_fed

gen prop_fcand_fed =.
replace prop_fcand_fed = 0.2162 if state == 1
replace prop_fcand_fed = 0.1875 if state == 2
replace prop_fcand_fed = 0.2549 if state == 3
replace prop_fcand_fed = 0.2838 if state == 4
replace prop_fcand_fed = 0.1193 if state == 5
replace prop_fcand_fed = 0.2105 if state == 6
replace prop_fcand_fed = 0.2128 if state == 7
replace prop_fcand_fed = 0.1667 if state == 8
replace prop_fcand_fed = 0.0924 if state == 9
replace prop_fcand_fed = 0.1267 if state == 10
replace prop_fcand_fed = 0.1298 if state == 11
replace prop_fcand_fed = 0.3284 if state == 12
replace prop_fcand_fed = 0.2647 if state == 13
replace prop_fcand_fed = 0.1864 if state == 14
replace prop_fcand_fed = 0.1688 if state == 15
replace prop_fcand_fed = 0.0795 if state == 16
replace prop_fcand_fed = 0.2644 if state == 17
replace prop_fcand_fed = 0.1887 if state == 18
replace prop_fcand_fed = 0.243 if state == 19
replace prop_fcand_fed = 0.1667 if state == 20
replace prop_fcand_fed = 0.2394 if state == 21
replace prop_fcand_fed = 0.2419 if state == 22
replace prop_fcand_fed = 0.2325 if state == 23
replace prop_fcand_fed = 0.2517 if state == 24
replace prop_fcand_fed = 0.1296 if state == 25
replace prop_fcand_fed = 0.1874 if state == 26
replace prop_fcand_fed = 0.25 if state == 27

summarize prop_fcand_fed

gen prop_fcand_fed01 = (prop_fcand_fed - r(min))/(r(max) - r(min))

* prop_fcand_fed_nl

gen prop_fcand_fed_nl =.
replace prop_fcand_fed_nl = 0.1765 if state == 1
replace prop_fcand_fed_nl = 0.16 if state == 2
replace prop_fcand_fed_nl = 0.0714 if state == 3
replace prop_fcand_fed_nl = 0.2576 if state == 4
replace prop_fcand_fed_nl = 0.0945 if state == 5
replace prop_fcand_fed_nl = 0.0909 if state == 6
replace prop_fcand_fed_nl = 0.1429 if state == 7
replace prop_fcand_fed_nl = 0.1515 if state == 8
replace prop_fcand_fed_nl = 0.1039 if state == 9
replace prop_fcand_fed_nl = 0.1206 if state == 10
replace prop_fcand_fed_nl = 0.0806 if state == 11
replace prop_fcand_fed_nl = 0.2308 if state == 12
replace prop_fcand_fed_nl = 0.2157 if state == 13
replace prop_fcand_fed_nl = 0.1087 if state == 14
replace prop_fcand_fed_nl = 0.0755 if state == 15
replace prop_fcand_fed_nl = 0.0833 if state == 16
replace prop_fcand_fed_nl = 0.1429 if state == 17
replace prop_fcand_fed_nl = 0.1185 if state == 18
replace prop_fcand_fed_nl = 0.2034 if state == 19
replace prop_fcand_fed_nl = 0.0889 if state == 20
replace prop_fcand_fed_nl = 0.2353 if state == 21
replace prop_fcand_fed_nl = 0.1731 if state == 22
replace prop_fcand_fed_nl = 0.1652 if state == 23
replace prop_fcand_fed_nl = 0.1982 if state == 24
replace prop_fcand_fed_nl = 0.1277 if state == 25
replace prop_fcand_fed_nl = 0.1412 if state == 26
replace prop_fcand_fed_nl = 0.2424 if state == 27

summarize prop_fcand_fed_nl

gen prop_fcand_fed_nl01 = (prop_fcand_fed_nl - r(min))/(r(max) - r(min))

* tot_cand_est

gen tot_cand_est =.
replace tot_cand_est = 325 if state == 1
replace tot_cand_est = 262 if state == 2
replace tot_cand_est = 352 if state == 3
replace tot_cand_est = 246 if state == 4
replace tot_cand_est = 588 if state == 5
replace tot_cand_est = 438 if state == 6
replace tot_cand_est = 796 if state == 7
replace tot_cand_est = 346 if state == 8
replace tot_cand_est = 538 if state == 9
replace tot_cand_est = 370 if state == 10
replace tot_cand_est = 942 if state == 11
replace tot_cand_est = 240 if state == 12
replace tot_cand_est = 226 if state == 13
replace tot_cand_est = 459 if state == 14
replace tot_cand_est = 252 if state == 15
replace tot_cand_est = 401 if state == 16
replace tot_cand_est = 181 if state == 17
replace tot_cand_est = 524 if state == 18
replace tot_cand_est = 1515 if state == 19
replace tot_cand_est = 157 if state == 20
replace tot_cand_est = 300 if state == 21
replace tot_cand_est = 352 if state == 22
replace tot_cand_est = 545 if state == 23
replace tot_cand_est = 307 if state == 24
replace tot_cand_est = 126 if state == 25
replace tot_cand_est = 1543 if state == 26
replace tot_cand_est = 212 if state == 27

summarize tot_cand_est

gen tot_cand_est01 = (tot_cand_est - r(min))/(r(max) - r(min))

gen ln_tot_cand_est = ln(tot_cand_est)

summarize ln_tot_cand_est

gen ln_tot_cand_est01 = (ln_tot_cand_est - r(min))/(r(max) - r(min))

* tot_cand_est_nl

gen tot_cand_est_nl =.
replace tot_cand_est_nl = 304 if state == 1
replace tot_cand_est_nl = 197 if state == 2
replace tot_cand_est_nl = 307 if state == 3
replace tot_cand_est_nl = 207 if state == 4
replace tot_cand_est_nl = 519 if state == 5
replace tot_cand_est_nl = 323 if state == 6
replace tot_cand_est_nl = 720 if state == 7
replace tot_cand_est_nl = 322 if state == 8
replace tot_cand_est_nl = 448 if state == 9
replace tot_cand_est_nl = 317 if state == 10
replace tot_cand_est_nl = 768 if state == 11
replace tot_cand_est_nl = 189 if state == 12
replace tot_cand_est_nl = 199 if state == 13
replace tot_cand_est_nl = 409 if state == 14
replace tot_cand_est_nl = 207 if state == 15
replace tot_cand_est_nl = 332 if state == 16
replace tot_cand_est_nl = 150 if state == 17
replace tot_cand_est_nl = 450 if state == 18
replace tot_cand_est_nl = 1413 if state == 19
replace tot_cand_est_nl = 112 if state == 20
replace tot_cand_est_nl = 286 if state == 21
replace tot_cand_est_nl = 307 if state == 22
replace tot_cand_est_nl = 454 if state == 23
replace tot_cand_est_nl = 255 if state == 24
replace tot_cand_est_nl = 109 if state == 25
replace tot_cand_est_nl = 1139 if state == 26
replace tot_cand_est_nl = 181 if state == 27

summarize tot_cand_est_nl

gen tot_cand_est_nl01 = (tot_cand_est_nl - r(min))/(r(max) - r(min))

gen ln_tot_cand_est_nl = ln(tot_cand_est_nl)

summarize ln_tot_cand_est_nl

gen ln_tot_cand_est_nl01 = (ln_tot_cand_est_nl - r(min))/(r(max) - r(min))


* prop_fcand_est

gen prop_fcand_est =.
replace prop_fcand_est = 0.2031 if state == 1
replace prop_fcand_est = 0.187 if state == 2
replace prop_fcand_est = 0.2784 if state == 3
replace prop_fcand_est = 0.2561 if state == 4
replace prop_fcand_est = 0.1599 if state == 5
replace prop_fcand_est = 0.2877 if state == 6
replace prop_fcand_est = 0.25 if state == 7
replace prop_fcand_est = 0.1012 if state == 8
replace prop_fcand_est = 0.197 if state == 9
replace prop_fcand_est = 0.1324 if state == 10
replace prop_fcand_est = 0.1486 if state == 11
replace prop_fcand_est = 0.2625 if state == 12
replace prop_fcand_est = 0.2345 if state == 13
replace prop_fcand_est = 0.244 if state == 14
replace prop_fcand_est = 0.1706 if state == 15
replace prop_fcand_est = 0.1471 if state == 16
replace prop_fcand_est = 0.2376 if state == 17
replace prop_fcand_est = 0.2405 if state == 18
replace prop_fcand_est = 0.2561 if state == 19
replace prop_fcand_est = 0.2102 if state == 20
replace prop_fcand_est = 0.15 if state == 21
replace prop_fcand_est = 0.2301 if state == 22
replace prop_fcand_est = 0.2477 if state == 23
replace prop_fcand_est = 0.228 if state == 24
replace prop_fcand_est = 0.1667 if state == 25
replace prop_fcand_est = 0.1698 if state == 26
replace prop_fcand_est = 0.1509 if state == 27

summarize prop_fcand_est

gen prop_fcand_est01 = (prop_fcand_est - r(min))/(r(max) - r(min))


* prop_fcand_est_nl

gen prop_fcand_est_nl =.
replace prop_fcand_est_nl = 0.1678 if state == 1
replace prop_fcand_est_nl = 0.1472 if state == 2
replace prop_fcand_est_nl = 0.2345 if state == 3
replace prop_fcand_est_nl = 0.1981 if state == 4
replace prop_fcand_est_nl = 0.1426 if state == 5
replace prop_fcand_est_nl = 0.195 if state == 6
replace prop_fcand_est_nl = 0.2056 if state == 7
replace prop_fcand_est_nl = 0.0901 if state == 8
replace prop_fcand_est_nl = 0.1585 if state == 9
replace prop_fcand_est_nl = 0.1293 if state == 10
replace prop_fcand_est_nl = 0.1263 if state == 11
replace prop_fcand_est_nl = 0.1693 if state == 12
replace prop_fcand_est_nl = 0.196 if state == 13
replace prop_fcand_est_nl = 0.1932 if state == 14
replace prop_fcand_est_nl = 0.1498 if state == 15
replace prop_fcand_est_nl = 0.1386 if state == 16
replace prop_fcand_est_nl = 0.18 if state == 17
replace prop_fcand_est_nl = 0.1978 if state == 18
replace prop_fcand_est_nl = 0.218 if state == 19
replace prop_fcand_est_nl = 0.1429 if state == 20
replace prop_fcand_est_nl = 0.1469 if state == 21
replace prop_fcand_est_nl = 0.1922 if state == 22
replace prop_fcand_est_nl = 0.1762 if state == 23
replace prop_fcand_est_nl = 0.1529 if state == 24
replace prop_fcand_est_nl = 0.156 if state == 25
replace prop_fcand_est_nl = 0.1326 if state == 26
replace prop_fcand_est_nl = 0.1547 if state == 27

summarize prop_fcand_est_nl

gen prop_fcand_est_nl01 = (prop_fcand_est_nl - r(min))/(r(max) - r(min))


* ln of asymmetrical variables

*gen ln_dismag_fed = ln(dismag_fed)

*gen ln_dismag_est = ln(dismag_est)

*gen ln_tot_cand_fed = ln(tot_cand_fed)

*gen ln_tot_cand_est = ln(tot_cand_est)


* gender gap in raw campaign expenses for chamber

gen gap_exp_fed =.
replace gap_exp_fed = 100215.5 if state == 1
replace gap_exp_fed = 18589.74 if state == 2
replace gap_exp_fed = -255931.2 if state == 3
replace gap_exp_fed = 256612.8 if state == 4
replace gap_exp_fed = -202288.1 if state == 5
replace gap_exp_fed = 4555.556 if state == 6
replace gap_exp_fed = 569729.7 if state == 7
replace gap_exp_fed = -139333.3 if state == 8
replace gap_exp_fed = -1774731 if state == 9
replace gap_exp_fed = -168806.7 if state == 10
replace gap_exp_fed = 30423.12 if state == 11
replace gap_exp_fed = 51919.19 if state == 12
replace gap_exp_fed = -343333.3 if state == 13
replace gap_exp_fed = 67878.79 if state == 14
replace gap_exp_fed = -1827927 if state == 15
replace gap_exp_fed = -1660498 if state == 16
replace gap_exp_fed = -138189.8 if state == 17
replace gap_exp_fed = 301175.3 if state == 18
replace gap_exp_fed = 179594.5 if state == 19
replace gap_exp_fed = 235800 if state == 20
replace gap_exp_fed = 190294.1 if state == 21
replace gap_exp_fed = -246879.4 if state == 22
replace gap_exp_fed = 24435.29 if state == 23
replace gap_exp_fed = -151240.8 if state == 24
replace gap_exp_fed = -97082.07 if state == 25
replace gap_exp_fed = 161841.1 if state == 26
replace gap_exp_fed = -293333.3 if state == 27

summarize gap_exp_fed

gen gap_exp_fed01 = (gap_exp_fed - r(min))/(r(max) - r(min))


* gender gap in logged campaign expenses for chamber

gen gap_lnexp_fed =.
replace gap_lnexp_fed = 0.0396503 if state == 1
replace gap_lnexp_fed = 0.1554106 if state == 2
replace gap_lnexp_fed = -0.4089404 if state == 3
replace gap_lnexp_fed = 0.0904766 if state == 4
replace gap_lnexp_fed = -0.1556971 if state == 5
replace gap_lnexp_fed = 0.0459551 if state == 6
replace gap_lnexp_fed = 0.3322536 if state == 7
replace gap_lnexp_fed = -0.1903341 if state == 8
replace gap_lnexp_fed = -0.2052119 if state == 9
replace gap_lnexp_fed = -0.2044409 if state == 10
replace gap_lnexp_fed = -0.052951 if state == 11
replace gap_lnexp_fed = -0.0674292 if state == 12
replace gap_lnexp_fed = -1.301599 if state == 13
replace gap_lnexp_fed = 0.1236362 if state == 14
replace gap_lnexp_fed = -0.4101729 if state == 15
replace gap_lnexp_fed = 0.0113493 if state == 16
replace gap_lnexp_fed = -0.0445698 if state == 17
replace gap_lnexp_fed = 0.141936 if state == 18
replace gap_lnexp_fed = 0.388519 if state == 19
replace gap_lnexp_fed = -0.3246114 if state == 20
replace gap_lnexp_fed = 0.114526 if state == 21
replace gap_lnexp_fed = -0.3754142 if state == 22
replace gap_lnexp_fed = 0.0887829 if state == 23
replace gap_lnexp_fed = -0.092058 if state == 24
replace gap_lnexp_fed = 1.096879 if state == 25
replace gap_lnexp_fed = 0.1065085 if state == 26
replace gap_lnexp_fed = -0.1818973 if state == 27

summarize gap_lnexp_fed

gen gap_lnexp_fed01 = (gap_lnexp_fed - r(min))/(r(max) - r(min))

* gender gap in raw campaign expenses for chamber standardized by state

gen gap_stdexp_fed =.
replace gap_stdexp_fed = 0.2427664 if state == 1
replace gap_stdexp_fed = 0.0118255 if state == 2
replace gap_stdexp_fed = -0.2492964 if state == 3
replace gap_stdexp_fed = 0.165223 if state == 4
replace gap_stdexp_fed = -0.1685899 if state == 5
replace gap_stdexp_fed = 0.0075867 if state == 6
replace gap_stdexp_fed = 0.3306111 if state == 7
replace gap_stdexp_fed = -0.2226274 if state == 8
replace gap_stdexp_fed = -0.1761435 if state == 9
replace gap_stdexp_fed = -0.1219183 if state == 10
replace gap_stdexp_fed = 0.023893 if state == 11
replace gap_stdexp_fed = 0.0554185 if state == 12
replace gap_stdexp_fed = -0.2919614 if state == 13
replace gap_stdexp_fed = 0.0806577 if state == 14
replace gap_stdexp_fed = -0.4295832 if state == 15
replace gap_stdexp_fed = -0.2837731 if state == 16
replace gap_stdexp_fed = -0.1338858 if state == 17
replace gap_stdexp_fed = 0.1266979 if state == 18
replace gap_stdexp_fed = 0.1262997 if state == 19
replace gap_stdexp_fed = 0.170441 if state == 20
replace gap_stdexp_fed = 0.2714926 if state == 21
replace gap_stdexp_fed = -0.0927062 if state == 22
replace gap_stdexp_fed = 0.0276926 if state == 23
replace gap_stdexp_fed = -0.1030083 if state == 24
replace gap_stdexp_fed = -0.110574 if state == 25
replace gap_stdexp_fed = 0.1052291 if state == 26
replace gap_stdexp_fed = -0.4845665 if state == 27

summarize gap_stdexp_fed

gen gap_stdexp_fed01 = (gap_stdexp_fed - r(min))/(r(max) - r(min))

* gender gap in logged campaign expenses for chamber standardized by state

gen gap_stdlnexp_fed =.
replace gap_stdlnexp_fed = 0.0945364 if state == 1
replace gap_stdlnexp_fed = 0.1073001 if state == 2
replace gap_stdlnexp_fed = -0.4184275 if state == 3
replace gap_stdlnexp_fed = 0.1015142 if state == 4
replace gap_stdlnexp_fed = -0.1261771 if state == 5
replace gap_stdlnexp_fed = 0.0499358 if state == 6
replace gap_stdlnexp_fed = 0.2878366 if state == 7
replace gap_stdlnexp_fed = -0.0482759 if state == 8
replace gap_stdlnexp_fed = -0.2204641 if state == 9
replace gap_stdlnexp_fed = -0.2179571 if state == 10
replace gap_stdlnexp_fed = -0.0716077 if state == 11
replace gap_stdlnexp_fed = -0.1131473 if state == 12
replace gap_stdlnexp_fed = -0.2940232 if state == 13
replace gap_stdlnexp_fed = 0.1458667 if state == 14
replace gap_stdlnexp_fed = -0.0773893 if state == 15
replace gap_stdlnexp_fed = 0.0090881 if state == 16
replace gap_stdlnexp_fed = -0.0383211 if state == 17
replace gap_stdlnexp_fed = 0.1103051 if state == 18
replace gap_stdlnexp_fed = 0.080242 if state == 19
replace gap_stdlnexp_fed = -0.2301257 if state == 20
replace gap_stdlnexp_fed = 0.1432976 if state == 21
replace gap_stdlnexp_fed = -0.2877937 if state == 22
replace gap_stdlnexp_fed = 0.0299854 if state == 23
replace gap_stdlnexp_fed = -0.0677371 if state == 24
replace gap_stdlnexp_fed = 0.2004539 if state == 25
replace gap_stdlnexp_fed = 0.1505028 if state == 26
replace gap_stdlnexp_fed = -0.4591697 if state == 27

summarize gap_stdlnexp_fed

gen gap_stdlnexp_fed01 = (gap_stdlnexp_fed - r(min))/(r(max) - r(min))


* gender gap in raw campaign expenses for chamber - WITHOUT LARANJAS

gen gap_exp_fed2 =.
replace gap_exp_fed2 = 129166.7 if state == 1
replace gap_exp_fed2 = -57142.86 if state == 2
replace gap_exp_fed2 = -386923.1 if state == 3
replace gap_exp_fed2 = 485798.3 if state == 4
replace gap_exp_fed2 = -268102.9 if state == 5
replace gap_exp_fed2 = 98142.86 if state == 6
replace gap_exp_fed2 = 84259.26 if state == 7
replace gap_exp_fed2 = -117142.9 if state == 8
replace gap_exp_fed2 = -3019094 if state == 9
replace gap_exp_fed2 = -100986.7 if state == 10
replace gap_exp_fed2 = -272932.1 if state == 11
replace gap_exp_fed2 = -24583.33 if state == 12
replace gap_exp_fed2 = -97045.45 if state == 13
replace gap_exp_fed2 = -305707.3 if state == 14
replace gap_exp_fed2 = -664132.7 if state == 15
replace gap_exp_fed2 = -1431033 if state == 16
replace gap_exp_fed2 = -332856 if state == 17
replace gap_exp_fed2 = 34985.81 if state == 18
replace gap_exp_fed2 = 93515.05 if state == 19
replace gap_exp_fed2 = -530487.8 if state == 20
replace gap_exp_fed2 = 288221.2 if state == 21
replace gap_exp_fed2 = -302403.1 if state == 22
replace gap_exp_fed2 = -1584.43 if state == 23
replace gap_exp_fed2 = 174887.6 if state == 24
replace gap_exp_fed2 = -201422.8 if state == 25
replace gap_exp_fed2 = -54150.93 if state == 26
replace gap_exp_fed2 = -370500 if state == 27

summarize gap_exp_fed2

gen gap_exp_fed201 = (gap_exp_fed2 - r(min))/(r(max) - r(min))


* gender gap in logged campaign expenses for chamber - WITHOUT LARANJAS

gen gap_lnexp_fed2 =.
replace gap_lnexp_fed2 = 0.0754138 if state == 1
replace gap_lnexp_fed2 = -0.1205434 if state == 2
replace gap_lnexp_fed2 = -0.4169369 if state == 3
replace gap_lnexp_fed2 = 0.1477162 if state == 4
replace gap_lnexp_fed2 = -0.1644256 if state == 5
replace gap_lnexp_fed2 = 0.2563672 if state == 6
replace gap_lnexp_fed2 = 0.0269621 if state == 7
replace gap_lnexp_fed2 = 0.1882273 if state == 8
replace gap_lnexp_fed2 = -0.2432398 if state == 9
replace gap_lnexp_fed2 = -0.1945173 if state == 10
replace gap_lnexp_fed2 = -0.1117333 if state == 11
replace gap_lnexp_fed2 = -0.1068115 if state == 12
replace gap_lnexp_fed2 = -0.8446795 if state == 13
replace gap_lnexp_fed2 = -0.128347 if state == 14
replace gap_lnexp_fed2 = 1.38678 if state == 15
replace gap_lnexp_fed2 = 0.1438161 if state == 16
replace gap_lnexp_fed2 = 0.0542877 if state == 17
replace gap_lnexp_fed2 = 0.1595731 if state == 18
replace gap_lnexp_fed2 = 0.2363482 if state == 19
replace gap_lnexp_fed2 = -0.7022582 if state == 20
replace gap_lnexp_fed2 = 0.2145873 if state == 21
replace gap_lnexp_fed2 = -0.2613385 if state == 22
replace gap_lnexp_fed2 = -0.1738979 if state == 23
replace gap_lnexp_fed2 = 0.0801168 if state == 24
replace gap_lnexp_fed2 = -0.1211533 if state == 25
replace gap_lnexp_fed2 = 0.0372864 if state == 26
replace gap_lnexp_fed2 = -0.2511751 if state == 27

summarize gap_lnexp_fed2

gen gap_lnexp_fed201 = (gap_lnexp_fed2 - r(min))/(r(max) - r(min))

* gender gap in raw campaign expenses for chamber standardized by state - WITHOUT LARANJAS

gen gap_stdexp_fed2 =.
replace gap_stdexp_fed2 = 0.3014468 if state == 1
replace gap_stdexp_fed2 = -0.0365273 if state == 2
replace gap_stdexp_fed2 = -0.3904353 if state == 3
replace gap_stdexp_fed2 = 0.3183326 if state == 4
replace gap_stdexp_fed2 = -0.2192441 if state == 5
replace gap_stdexp_fed2 = 0.1665169 if state == 6
replace gap_stdexp_fed2 = 0.0607255 if state == 7
replace gap_stdexp_fed2 = -0.1864561 if state == 8
replace gap_stdexp_fed2 = -0.2899032 if state == 9
replace gap_stdexp_fed2 = -0.0720643 if state == 10
replace gap_stdexp_fed2 = -0.2128013 if state == 11
replace gap_stdexp_fed2 = -0.0253051 if state == 12
replace gap_stdexp_fed2 = -0.0823722 if state == 13
replace gap_stdexp_fed2 = -0.3760213 if state == 14
replace gap_stdexp_fed2 = -0.1427713 if state == 15
replace gap_stdexp_fed2 = -0.2678888 if state == 16
replace gap_stdexp_fed2 = -0.3406897 if state == 17
replace gap_stdexp_fed2 = 0.0147399 if state == 18
replace gap_stdexp_fed2 = 0.0651427 if state == 19
replace gap_stdexp_fed2 = -0.3651404 if state == 20
replace gap_stdexp_fed2 = 0.4219877 if state == 21
replace gap_stdexp_fed2 = -0.1091593 if state == 22
replace gap_stdexp_fed2 = -0.0018698 if state == 23
replace gap_stdexp_fed2 = 0.1211765 if state == 24
replace gap_stdexp_fed2 = -0.2466099 if state == 25
replace gap_stdexp_fed2 = -0.0384774 if state == 26
replace gap_stdexp_fed2 = -0.5805516 if state == 27

summarize gap_stdexp_fed2

gen gap_stdexp_fed201 = (gap_stdexp_fed2 - r(min))/(r(max) - r(min))

* gender gap in logged campaign expenses for chamber standardized by state - WITHOUT LARANJAS

gen gap_stdlnexp_fed2 =.
replace gap_stdlnexp_fed2 = 0.1746003 if state == 1
replace gap_stdlnexp_fed2 = -0.0942453 if state == 2
replace gap_stdlnexp_fed2 = -0.4138287 if state == 3
replace gap_stdlnexp_fed2 = 0.1627355 if state == 4
replace gap_stdlnexp_fed2 = -0.1257836 if state == 5
replace gap_stdlnexp_fed2 = 0.2723379 if state == 6
replace gap_stdlnexp_fed2 = 0.0368374 if state == 7
replace gap_stdlnexp_fed2 = 0.0494251 if state == 8
replace gap_stdlnexp_fed2 = -0.2385002 if state == 9
replace gap_stdlnexp_fed2 = -0.2009819 if state == 10
replace gap_stdlnexp_fed2 = -0.1453937 if state == 11
replace gap_stdlnexp_fed2 = -0.1648282 if state == 12
replace gap_stdlnexp_fed2 = -0.1766209 if state == 13
replace gap_stdlnexp_fed2 = -0.1455507 if state == 14
replace gap_stdlnexp_fed2 = 0.2671984 if state == 15
replace gap_stdlnexp_fed2 = 0.123048 if state == 16
replace gap_stdlnexp_fed2 = 0.0546495 if state == 17
replace gap_stdlnexp_fed2 = 0.1266353 if state == 18
replace gap_stdlnexp_fed2 = 0.0492681 if state == 19
replace gap_stdlnexp_fed2 = -0.4651313 if state == 20
replace gap_stdlnexp_fed2 = 0.2933594 if state == 21
replace gap_stdlnexp_fed2 = -0.2015792 if state == 22
replace gap_stdlnexp_fed2 = -0.096547 if state == 23
replace gap_stdlnexp_fed2 = 0.0707966 if state == 24
replace gap_stdlnexp_fed2 = -0.0236562 if state == 25
replace gap_stdlnexp_fed2 = 0.0574178 if state == 26
replace gap_stdlnexp_fed2 = -0.601857 if state == 27

summarize gap_stdlnexp_fed2

gen gap_stdlnexp_fed201 = (gap_stdlnexp_fed2 - r(min))/(r(max) - r(min))


* gender gap in raw campaign expenses for state assembly

gen gap_exp_est =.
replace gap_exp_est = 472443.5 if state == 1
replace gap_exp_est = -175695.1 if state == 2
replace gap_exp_est = 55901.49 if state == 3
replace gap_exp_est = -341181.4 if state == 4
replace gap_exp_est = -136230.5 if state == 5
replace gap_exp_est = 71077.53 if state == 6
replace gap_exp_est = -39447.24 if state == 7
replace gap_exp_est = -2921.452 if state == 8
replace gap_exp_est = 189320.4 if state == 9
replace gap_exp_est = -58201.41 if state == 10
replace gap_exp_est = 82249.2 if state == 11
replace gap_exp_est = -36978.75 if state == 12
replace gap_exp_est = 109074.1 if state == 13
replace gap_exp_est = 108424 if state == 14
replace gap_exp_est = -2631169 if state == 15
replace gap_exp_est = 82939.64 if state == 16
replace gap_exp_est = 87926.92 if state == 17
replace gap_exp_est = 188780.4 if state == 18
replace gap_exp_est = -1684.062 if state == 19
replace gap_exp_est = 136317.2 if state == 20
replace gap_exp_est = 13202.61 if state == 21
replace gap_exp_est = 2207.189 if state == 22
replace gap_exp_est = 64875.34 if state == 23
replace gap_exp_est = -111627.8 if state == 24
replace gap_exp_est = 97476.19 if state == 25
replace gap_exp_est = -285405.3 if state == 26
replace gap_exp_est = -82222.22 if state == 27

summarize gap_exp_est

gen gap_exp_est01 = (gap_exp_est - r(min))/(r(max) - r(min))


* gender gap in logged campaign expenses for state assembly

gen gap_lnexp_est =.
replace gap_lnexp_est = 0.3105768 if state == 1
replace gap_lnexp_est = -0.0528282 if state == 2
replace gap_lnexp_est = 0.0642178 if state == 3
replace gap_lnexp_est = -0.0749142 if state == 4
replace gap_lnexp_est = -0.0162469 if state == 5
replace gap_lnexp_est = 0.0540431 if state == 6
replace gap_lnexp_est = -0.0225773 if state == 7
replace gap_lnexp_est = -0.0080941 if state == 8
replace gap_lnexp_est = 0.1935588 if state == 9
replace gap_lnexp_est = -0.072522 if state == 10
replace gap_lnexp_est = 0.0601504 if state == 11
replace gap_lnexp_est = -0.0433443 if state == 12
replace gap_lnexp_est = 0.1188958 if state == 13
replace gap_lnexp_est = 0.0984479 if state == 14
replace gap_lnexp_est = -0.769559 if state == 15
replace gap_lnexp_est = 0.0164348 if state == 16
replace gap_lnexp_est = 0.089469 if state == 17
replace gap_lnexp_est = 0.1605935 if state == 18
replace gap_lnexp_est = 0.1265976 if state == 19
replace gap_lnexp_est = 0.0873888 if state == 20
replace gap_lnexp_est = 0.0009577 if state == 21
replace gap_lnexp_est = -0.008818 if state == 22
replace gap_lnexp_est = 0.1352797 if state == 23
replace gap_lnexp_est = -0.08964 if state == 24
replace gap_lnexp_est = 0.6421598 if state == 25
replace gap_lnexp_est = -0.1207249 if state == 26
replace gap_lnexp_est = -0.1110047 if state == 27

summarize gap_lnexp_est

gen gap_lnexp_est01 = (gap_lnexp_est - r(min))/(r(max) - r(min))


* gender gap in raw campaign expenses for state assembly standardized y state

gen gap_stdexp_est =.
replace gap_stdexp_est = 0.3230048 if state == 1
replace gap_stdexp_est = -0.1360189 if state == 2
replace gap_stdexp_est = 0.1726888 if state == 3
replace gap_stdexp_est = -0.1631629 if state == 4
replace gap_stdexp_est = -0.1517579 if state == 5
replace gap_stdexp_est = 0.1756374 if state == 6
replace gap_stdexp_est = -0.0471895 if state == 7
replace gap_stdexp_est = -0.0069527 if state == 8
replace gap_stdexp_est = 0.2160378 if state == 9
replace gap_stdexp_est = -0.0658459 if state == 10
replace gap_stdexp_est = 0.094925 if state == 11
replace gap_stdexp_est = -0.0843494 if state == 12
replace gap_stdexp_est = 0.3104551 if state == 13
replace gap_stdexp_est = 0.015354 if state == 14
replace gap_stdexp_est = -0.5180903 if state == 15
replace gap_stdexp_est = 0.0131223 if state == 16
replace gap_stdexp_est = 0.053464 if state == 17
replace gap_stdexp_est = 0.1717842 if state == 18
replace gap_stdexp_est = -0.0015031 if state == 19
replace gap_stdexp_est = 0.2404904 if state == 20
replace gap_stdexp_est = 0.0353051 if state == 21
replace gap_stdexp_est = 0.0019631 if state == 22
replace gap_stdexp_est = 0.1747415 if state == 23
replace gap_stdexp_est = -0.1371786 if state == 24
replace gap_stdexp_est = 0.230189 if state == 25
replace gap_stdexp_est = -0.2122656 if state == 26
replace gap_stdexp_est = -0.4222341 if state == 27

summarize gap_stdexp_est

gen gap_stdexp_est01 = (gap_stdexp_est - r(min))/(r(max) - r(min))


* gender gap in logged campaign expenses for state assembly standardized y state

gen gap_stdlnexp_est =.
replace gap_stdlnexp_est = 0.3458434 if state == 1
replace gap_stdlnexp_est = -0.0443605 if state == 2
replace gap_stdlnexp_est = 0.152443 if state == 3
replace gap_stdlnexp_est = -0.0683289 if state == 4
replace gap_stdlnexp_est = -0.0149112 if state == 5
replace gap_stdlnexp_est = 0.0730477 if state == 6
replace gap_stdlnexp_est = -0.0356886 if state == 7
replace gap_stdlnexp_est = -0.0163814 if state == 8
replace gap_stdlnexp_est = 0.2603674 if state == 9
replace gap_stdlnexp_est = -0.0891285 if state == 10
replace gap_stdlnexp_est = 0.08783 if state == 11
replace gap_stdlnexp_est = -0.1111194 if state == 12
replace gap_stdlnexp_est = 0.3300988 if state == 13
replace gap_stdlnexp_est = 0.0723026 if state == 14
replace gap_stdlnexp_est = -0.4557009 if state == 15
replace gap_stdlnexp_est = 0.0158223 if state == 16
replace gap_stdlnexp_est = 0.1016621 if state == 17
replace gap_stdlnexp_est = 0.1354886 if state == 18
replace gap_stdlnexp_est = 0.0377449 if state == 19
replace gap_stdlnexp_est = 0.0920754 if state == 20
replace gap_stdlnexp_est = 0.0017507 if state == 21
replace gap_stdlnexp_est = -0.0073541 if state == 22
replace gap_stdlnexp_est = 0.1024904 if state == 23
replace gap_stdlnexp_est = -0.097675 if state == 24
replace gap_stdlnexp_est = 0.1282665 if state == 25
replace gap_stdlnexp_est = -0.1589574 if state == 26
replace gap_stdlnexp_est = -0.411631 if state == 27

summarize gap_stdlnexp_est

gen gap_stdlnexp_est01 = (gap_stdlnexp_est - r(min))/(r(max) - r(min))


* gender gap in raw campaign expenses for state assembly - WITHOUT LARANJAS

gen gap_exp_est2 =.
replace gap_exp_est2 = 436722.1 if state == 1
replace gap_exp_est2 = -337834.6 if state == 2
replace gap_exp_est2 = 46580.38 if state == 3
replace gap_exp_est2 = -414540.1 if state == 4
replace gap_exp_est2 = -76844.82 if state == 5
replace gap_exp_est2 = 105443.2 if state == 6
replace gap_exp_est2 = -2860.99 if state == 7
replace gap_exp_est2 = 5461.928 if state == 8
replace gap_exp_est2 = 101418.2 if state == 9
replace gap_exp_est2 = -55623.9 if state == 10
replace gap_exp_est2 = 188423 if state == 11
replace gap_exp_est2 = -87042.2 if state == 12
replace gap_exp_est2 = 36402.24 if state == 13
replace gap_exp_est2 = -577701.2 if state == 14
replace gap_exp_est2 = -3118783 if state == 15
replace gap_exp_est2 = 150620.2 if state == 16
replace gap_exp_est2 = -283044.2 if state == 17
replace gap_exp_est2 = 246636.9 if state == 18
replace gap_exp_est2 = 9215.49 if state == 19
replace gap_exp_est2 = 154166.7 if state == 20
replace gap_exp_est2 = 25009.76 if state == 21
replace gap_exp_est2 = -28052.9 if state == 22
replace gap_exp_est2 = 37259.02 if state == 23
replace gap_exp_est2 = -169820.2 if state == 24
replace gap_exp_est2 = 15230.18 if state == 25
replace gap_exp_est2 = -305215.7 if state == 26
replace gap_exp_est2 = -110597.6 if state == 27

summarize gap_exp_est2

gen gap_exp_est201 = (gap_exp_est2 - r(min))/(r(max) - r(min))


* gender gap in logged campaign expenses for state assembly- WITHOUT LARANJAS

gen gap_lnexp_est2 =.
replace gap_lnexp_est2 = 0.2715389 if state == 1
replace gap_lnexp_est2 = -0.2458248 if state == 2
replace gap_lnexp_est2 = 0.0632154 if state == 3
replace gap_lnexp_est2 = -0.0874676 if state == 4
replace gap_lnexp_est2 = -0.1073039 if state == 5
replace gap_lnexp_est2 = 0.0863897 if state == 6
replace gap_lnexp_est2 = -0.019727 if state == 7
replace gap_lnexp_est2 = -0.0022184 if state == 8
replace gap_lnexp_est2 = 0.108229 if state == 9
replace gap_lnexp_est2 = -0.0691131 if state == 10
replace gap_lnexp_est2 = 0.0813331 if state == 11
replace gap_lnexp_est2 = -0.0651719 if state == 12
replace gap_lnexp_est2 = 0.0429513 if state == 13
replace gap_lnexp_est2 = -0.0468594 if state == 14
replace gap_lnexp_est2 = -0.7426467 if state == 15
replace gap_lnexp_est2 = 0.0629398 if state == 16
replace gap_lnexp_est2 = -0.0001225 if state == 17
replace gap_lnexp_est2 = 0.2338114 if state == 18
replace gap_lnexp_est2 = 0.2108185 if state == 19
replace gap_lnexp_est2 = 0.2466956 if state == 20
replace gap_lnexp_est2 = 0.0129691 if state == 21
replace gap_lnexp_est2 = -0.0188376 if state == 22
replace gap_lnexp_est2 = 0.2473497 if state == 23
replace gap_lnexp_est2 = -0.0282236 if state == 24
replace gap_lnexp_est2 = 0.1481579 if state == 25
replace gap_lnexp_est2 = -0.1112496 if state == 26
replace gap_lnexp_est2 = -0.1518964 if state == 27

summarize gap_lnexp_est2

gen gap_lnexp_est201 = (gap_lnexp_est2 - r(min))/(r(max) - r(min))


* gender gap in raw campaign expenses for state assembly standardized by state - WITHOUT LARANJAS

gen gap_stdexp_est2=.
replace gap_stdexp_est2 = 0.2900505 if state == 1
replace gap_stdexp_est2 = -0.2541059 if state == 2
replace gap_stdexp_est2 = 0.1405803 if state == 3
replace gap_stdexp_est2 = -0.1993748 if state == 4
replace gap_stdexp_est2 = -0.0848316 if state == 5
replace gap_stdexp_est2 = 0.2555004 if state == 6
replace gap_stdexp_est2 = -0.003464 if state == 7
replace gap_stdexp_est2 = 0.0131262 if state == 8
replace gap_stdexp_est2 = 0.1179369 if state == 9
replace gap_stdexp_est2 = -0.0633034 if state == 10
replace gap_stdexp_est2 = 0.2249998 if state == 11
replace gap_stdexp_est2 = -0.207864 if state == 12
replace gap_stdexp_est2 = 0.1082804 if state == 13
replace gap_stdexp_est2 = -0.0797243 if state == 14
replace gap_stdexp_est2 = -0.5892834 if state == 15
replace gap_stdexp_est2 = 0.0231765 if state == 16
replace gap_stdexp_est2 = -0.1785075 if state == 17
replace gap_stdexp_est2 = 0.2267149 if state == 18
replace gap_stdexp_est2 = 0.008213 if state == 19
replace gap_stdexp_est2 = 0.2749011 if state == 20
replace gap_stdexp_est2 = 0.0665638 if state == 21
replace gap_stdexp_est2 = -0.0235813 if state == 22
replace gap_stdexp_est2 = 0.1073632 if state == 23
replace gap_stdexp_est2 = -0.2043441 if state == 24
replace gap_stdexp_est2 = 0.0356791 if state == 25
replace gap_stdexp_est2 = -0.2411841 if state == 26
replace gap_stdexp_est2 = -0.5488651 if state == 27

summarize gap_stdexp_est2

gen gap_stdexp_est201 = (gap_stdexp_est2 - r(min))/(r(max) - r(min))



* gender gap in logged campaign expenses for state assembly standardized by state - WITHOUT LARANJAS

gen gap_stdlnexp_est2=.
replace gap_stdlnexp_est2 = 0.2950001 if state == 1
replace gap_stdlnexp_est2 = -0.2140607 if state == 2
replace gap_stdlnexp_est2 = 0.1455322 if state == 3
replace gap_stdlnexp_est2 = -0.0790336 if state == 4
replace gap_stdlnexp_est2 = -0.1121834 if state == 5
replace gap_stdlnexp_est2 = 0.1176452 if state == 6
replace gap_stdlnexp_est2 = -0.0316541 if state == 7
replace gap_stdlnexp_est2 = -0.0044532 if state == 8
replace gap_stdlnexp_est2 = 0.1519879 if state == 9
replace gap_stdlnexp_est2 = -0.0819417 if state == 10
replace gap_stdlnexp_est2 = 0.1275262 if state == 11
replace gap_stdlnexp_est2 = -0.1866806 if state == 12
replace gap_stdlnexp_est2 = 0.1244416 if state == 13
replace gap_stdlnexp_est2 = -0.0346259 if state == 14
replace gap_stdlnexp_est2 = -0.4508406 if state == 15
replace gap_stdlnexp_est2 = 0.0613899 if state == 16
replace gap_stdlnexp_est2 = -0.0001366 if state == 17
replace gap_stdlnexp_est2 = 0.201124 if state == 18
replace gap_stdlnexp_est2 = 0.0614053 if state == 19
replace gap_stdlnexp_est2 = 0.2727891 if state == 20
replace gap_stdlnexp_est2 = 0.0233622 if state == 21
replace gap_stdlnexp_est2 = -0.0155191 if state == 22
replace gap_stdlnexp_est2 = 0.2258017 if state == 23
replace gap_stdlnexp_est2 = -0.0295896 if state == 24
replace gap_stdlnexp_est2 = 0.0296446 if state == 25
replace gap_stdlnexp_est2 = -0.1740223 if state == 26
replace gap_stdlnexp_est2 = -0.542819 if state == 27

summarize gap_stdlnexp_est2

gen gap_stdlnexp_est201 = (gap_stdlnexp_est2 - r(min))/(r(max) - r(min))

* sample size of each state

gen one = 1

egen ssize_state = count(one), by(state)

drop one

summarize ssize

gen ssize01 = (ssize - r(min))/(r(max) - r(min))

gen ln_ssize = ln(ssize_state)

summarize ln_ssize

gen ln_ssize01 = (ln_ssize - r(min))/(r(max) - r(min))


***********  ANALISES ******
* use weight [pweight=pesopop]

*** INDIVIDUAL LEVEL WITH PROBIT AND FIXED EFFECTS 

* Federal Chamber

probit vfemfed fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state3 state5 state7 state8 state9 state10 state11 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state23 state24 state26 state27 [pweight=pesopop] if vfemfed!=-1, cluster(state)

margins, dydx(*)

*margins, at(fsexism=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Explicit Sexism, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4" 0.5 "0.5",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

*margins, at(information01=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Political Information, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4" 0.5 "0.5",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)


* State Chamber

probit vfemest fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state2 state3 state4 state5 state6 state7 state8 state9 state10 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state23 state25 state26 state27 [pweight=pesopop] if vfemest!=-1, cluster(state)

margins, dydx(*)

*margins, at(fsexism=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Explicit Sexism, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4" 0.5 "0.5",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

*margins, at(information01=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Political Information, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4" 0.5 "0.5",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

* Senate

probit vfemsen_any fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state4 state5 state6 state7 state8 state9 state10 state13 state15 state16 state20 state21 state22 state24 state26  [pweight=pesopop] if womensen==1, cluster(state)

margins, dydx(*)

*margins, at(fsexism=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Explicit Sexism, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0"  0.2 "0.2" 0.4 "0.4" 0.6 "0.6" 0.8 "0.8" 1 "1",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

*margins, at(information01=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Political Information, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0"  0.2 "0.2" 0.4 "0.4" 0.6 "0.6" 0.8 "0.8" 1 "1",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)


* Governor

probit vfemgov fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state7 state8 state10 state18 state20 state21 state24 state16 [pweight=pesopop] if womengov==1 & vfemgov!=-1, cluster(state)

margins, dydx(*)

*margins, at(fsexism=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Explicit Sexism, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4" 0.5 "0.5",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

*margins, at(information01=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Political Information, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4" 0.5 "0.5",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)


* President 1st Round

*mprobit vote1 fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop], base(2)

probit vote_fem1 fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop]

margins, dydx(*)

*margins, at(fsexism=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Explicit Sexism, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0"  0.2 "0.2" 0.4 "0.4" 0.6 "0.6" 0.8 "0.8" 1 "1",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

*margins, at(information01=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Political Information, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0"  0.2 "0.2" 0.4 "0.4" 0.6 "0.6" 0.8 "0.8" 1 "1",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

* President 2nd Round

probit vote2 fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop]

margins, dydx(*)

*margins, at(fsexism=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Explicit Sexism, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0"  0.2 "0.2" 0.4 "0.4" 0.6 "0.6" 0.8 "0.8" 1 "1",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)

*margins, at(information01=(0(.1)1))

*marginsplot, plot1(lcolor(gs10) mcolor(gs10) msize(vtiny)) ci1(lcolor(gs10) fcolor(gs10) msize(vtiny)) recastci(rarea) ytitle("") xtitle(Political Information, size(large) margin(medsmall)) xlabel(0 "Lowest" 1 "Highest", noticks labsize(medium)) ylabel(0 "0"  0.2 "0.2" 0.4 "0.4" 0.6 "0.6" 0.8 "0.8" 1 "1",nogrid) title("", color(black) size(large)) yscale(noextend) xscale(noextend)  plotregion(style(none)  margin(medlarge)) graphregion(color(white)  margin(medlarge)) ysize(8) xsize(8)


******  ROBUSTNESS CHECK: controlling for state�s sample size

* DIRECT EFFECTS

*federal chamber (no change, residuals are affected)

probit vfemfed c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 ln_ssize01 c.fsexism c.information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)

predict residuals1, stdp

reg residuals c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 ln_ssize01 c.fsexism c.information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)

* state assembly (no change, residuals are affected)

probit vfemest c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 ln_ssize01 c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)

predict residuals2, stdp

reg residuals2 c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 ln_ssize01 c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)

* MODERATION 1: campaign spending and information

*federal chamber (no change, residuals affected)

probit vfemfed c.information01##c.gap_lnexp_fed201 ln_tot_cand_fed_nl01 prop_fcand_fed_nl01 gdppc01 c.information01##c.ln_ssize01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)

predict residuals3, stdp

reg residuals3 c.gap_lnexp_fed201 ln_tot_cand_fed_nl01 prop_fcand_fed_nl01 gdppc01 c.ln_ssize01 fsexism c.information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)

* state assembly (no change, residuals affected)

probit vfemest c.information01##c.gap_lnexp_est201 ln_tot_cand_est_nl01 prop_fcand_est_nl01 gdppc01 c.information01##c.ln_ssize01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)

predict residuals4, stdp

reg residuals4 c.gap_lnexp_est201 ln_tot_cand_est_nl01 prop_fcand_est_nl01 gdppc01 c.ln_ssize01 c.information01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)

* MODERATION 2: district magnitude and information 

*federal chamber (no change, residuals affected)

probit vfemfed c.information01##c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 c.information01##c.ln_ssize01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)

predict residuals5, stdp

reg residuals5 c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 c.ln_ssize01 c.information01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)


* state assembly (no change, residuals affected)

probit vfemest c.information01##c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 c.information01##c.ln_ssize01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)

predict residuals6, stdp

reg residuals6 c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 c.ln_ssize01 c.information01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)

* MODERATION 3: district magnitude and sexism 

*federal chamber (no change, residuals affected)

probit vfemfed c.fsexism##c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 c.fsexism##c.ln_ssize01 information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01[pweight=pesopop] if vfemfed!=-1, cluster(state)

predict residuals7, stdp

reg residuals7 c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 c.ln_ssize01 information01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)

* state assembly  (results improve, residuals not affected)

probit vfemest c.fsexism##c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 c.fsexism##c.ln_ssize01 information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)

predict residuals8, stdp

reg residuals8 c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 c.ln_ssize01 information01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)


******  ROBUSTNESS CHECK: models for states with large samples

* MAIN MODELS

*federal chamber (no change, less certainty)

probit vfemfed c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 c.fsexism c.information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1 & bigstate2==1, cluster(state)

* state assembly (no change, less certainty)

probit vfemest c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1 & bigstate2==1, cluster(state)

* MODERATION MODELS

* campaign spending and information

*federal chamber (no change)

probit vfemfed c.information01##c.gap_lnexp_fed201 ln_tot_cand_fed_nl01 prop_fcand_fed_nl01 gdppc01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1 & bigstate2==1, cluster(state)

* state assembly (no change)

probit vfemest c.information01##c.gap_lnexp_est201 ln_tot_cand_est_nl01 prop_fcand_est_nl01 gdppc01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1 & bigstate2==1, cluster(state)

* district magnitude and information

*federal chamber (no change)

probit vfemfed c.information01##c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1 & bigstate2==1, cluster(state)

* state assembly (no change)

probit vfemest c.information01##c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 fsexism idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1 & bigstate2==1, cluster(state)

* district magnitude and sexism

*federal chamber (no change)

probit vfemfed c.fsexism##c.ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1 & bigstate2==1, cluster(state)

* state assembly (no change)

probit vfemest c.fsexism##c.ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1 & bigstate2==1, cluster(state)


******  ROBUSTNESS CHECK: controlling for vote for Dilma in individual-level models (no change)

* vote for women in 1st round

* federal chamber

probit vfemfed fsexism information01 vote_fem1 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state3 state5 state7 state8 state9 state10 state11 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state23 state24 state26 state27 [pweight=pesopop] if vfemfed!=-1, cluster(state)

* state assembly

probit vfemest fsexism information01 vote_fem1 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state2 state3 state4 state5 state6 state7 state8 state9 state10 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state23 state25 state26 state27 [pweight=pesopop] if vfemest!=-1, cluster(state)

* senate

probit vfemsen_any fsexism information01 vote_fem1 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state4 state5 state6 state7 state8 state9 state10 state13 state15 state16 state20 state21 state22 state24 state26  [pweight=pesopop] if womensen==1, cluster(state)

* state government

probit vfemgov fsexism information01 vote_fem1 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state7 state8 state10 state18 state20 state21 state24 state16 [pweight=pesopop] if womengov==1 & vfemgov!=-1, cluster(state)

* vote for woman in 2nd round

* federal chamber

probit vfemfed fsexism information01 vote2 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state3 state5 state7 state8 state9 state10 state11 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state23 state24 state26 state27 [pweight=pesopop] if vfemfed!=-1, cluster(state)

* state assembly

probit vfemest fsexism information01 vote2 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state2 state3 state4 state5 state6 state7 state8 state9 state10 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state23 state25 state26 state27 [pweight=pesopop] if vfemest!=-1, cluster(state)

* senate

probit vfemsen_any fsexism information01 vote2 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state4 state5 state6 state7 state8 state9 state10 state13 state15 state16 state20 state21 state22 state24 state26  [pweight=pesopop] if womensen==1, cluster(state)

* state government

probit vfemgov fsexism information01 vote2 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state7 state8 state10 state18 state20 state21 state24 state16 [pweight=pesopop] if womengov==1 & vfemgov!=-1, cluster(state)

******  ROBUSTNESS CHECK: different senate vote variable

* voting for a woman only as first vote (same results)

probit vfemsen1 fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state4 state5 state6 state7 state8 state9 state13 state16 state20 state21 state22 state24 state26  [pweight=pesopop] if womensen==1 & vfemsen1!=-1, cluster(state)

* voting for a woman as nominal (same results for first vote)

mlogit vfemsen fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 state4 state5 state6 state7 state8 state9 state10 state13 state15 state16 state20 state21 state22 state24 state26  [pweight=pesopop] if womensen==1 & vfemsen!=-1, base(0) cluster(state)

******  ROBUSTNESS CHECK: placebo models

* campaign spending and sexism 

* FEDERAL CHAMBER

probit vfemfed c.fsexism##c.gap_exp_fed201 ln_tot_cand_fed_nl01 prop_fcand_fed_nl01 gdppc01 information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 [pweight=pesopop] if vfemfed!=-1, cluster(state)

* STATE ASSEMBLY

probit vfemest c.fsexism##c.gap_exp_est201 ln_tot_cand_est_nl01 prop_fcand_est01 gdppc01 information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 [pweight=pesopop] if vfemest!=-1, cluster(state)


******  ROBUSTNESS CHECK: selection models

*** INDIVIDUAL LEVEL WITH HECKMAN
* (selection only for governor, but does not affect results)

* FEDERAL CHAMBER (no change, no selection)

heckprob vfemfed c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 state3 state5 state7 state8 state9 state10 state11 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state24 state26 [pweight=pesopop], select(select_vfemfed= c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 state3 state5 state7 state8 state9 state10 state11 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state24 state26) cluster(state)


* STATE CHAMBER (no change, no selection)

heckprob vfemest c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 state3 state5 state7 state8 state9 state10 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state24 state26 [pweight=pesopop], select(select_vfemest= c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 state2 state3 state4 state5 state6 state7 state8 state9 state10 state12 state13 state14 state15 state16 state17 state18 state19 state20 state21 state22 state24 state25 state26 state27) cluster(state)

* SENATE (no change, selection)

heckprob vfemsen_any c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01  state4 state5 state6 state7 state8 state9 state10 state13 state15 state16 state20 state21 state22 state24 state26 [pweight=pesopop] if womensen==1, select(select_vfemsen_any= c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01  state4 state5 state6 state7 state8 state9 state10 state13 state15 state16 state20 state21 state22 state24 state26) cluster(state)

* STATE GOVERNMENT (no change, selection)

heckprob vfemgov c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 state7 state8 state10 state16 state18 state20 state21 state24 [pweight=pesopop] if womengov==1, select(select_vfemgov= c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 state7 state8 state10 state16 state18 state20 state21 state24) cluster(state)

* PRESIDENT FIRST ROUND: no need for state fixed effects since nation wide popular vote (no change, no selection)

heckprob vote_fem1 c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 [pweight=pesopop], select(select_vote_fem1= c.fsexism information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01)

* ONLY ABOUT 5% MISSING IN VOTE FOR SECOND ROUND, NO NEED FOR HECKMAN MODEL


*** DIRECT EFFECT OF STATE VARIABLES WITH HECKMAN
* (no selection)

* FEDERAL CHAMBER

heckprob vfemfed c.ln_tot_cand_fed_nl01 gap_exp_fed201 prop_fcand_fed_nl01 gdppc01 c.fsexism c.information01  idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 [pweight=pesopop], select(select_vfemfed= c.ln_tot_cand_fed_nl01 gap_exp_fed201 prop_fcand_fed_nl01 gdppc01 c.fsexism c.information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01) cluster(state)


* STATE CHAMBER

heckprob vfemest c.ln_tot_cand_est_nl01 gap_exp_est201 prop_fcand_est_nl01 gdppc01 c.fsexism c.information01  idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01 [pweight=pesopop], select(select_vfemest= c.ln_tot_cand_est_nl01 gap_exp_est201 prop_fcand_est_nl01 gdppc01 c.fsexism  information01 idpt idpsdb idpv left center right evangelical catholic campaign01 newspaper01 partprogram urban education01 jobmarket woman age01 white socioretro01 pocketretro01) cluster(state)


* commands for predicted margins outside of the 0-1 bound
*margins, at(fsexism=(0(1)1) dismag_fed01=(0(1)1)) predict(xb)
*transform_margins invlogit(@)


************************************************************

*** DESCRIPTIVE STATISTICS

summarize vfemfed [aweight=pesopop] if vfemfed!=-1

summarize vfemest [aweight=pesopop] if vfemest!=-1

summarize vfemsen_any [aweight=pesopop] if vfemsen_any!=-1

summarize vfemgov [aweight=pesopop] if vfemgov!=-1

summarize vote_fem1 vote2 [aweight=pesopop]

summarize fsexism information01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 [aweight=pesopop]

************************************************************

*** correlations between votes

pwcorr vfemfed vfemest vfemsen_any vfemgov vote_fem1 vote2 [aweight=pesopop] if vfemfed!=-1 & vfemest!=-1 & vfemsen_any!=-1 & vfemgov!=-1, sig


************************************************************

* descriptives for state-level variables: requires opening the dataset again later

sample 1, by(state) count

summarize ln_tot_cand_fed_nl01 ln_tot_cand_est_nl01 dismag_fed01 dismag_est01 gap_lnexp_fed201 gap_lnexp_est201 prop_fcand_fed_nl01 prop_fcand_est_nl01 gdppc01 ln_ssize01

* correlatioms for state-level variables: requires opening the dataset again later

pwcorr ln_tot_cand_fed_nl01 gap_lnexp_fed201 prop_fcand_fed_nl01 gdppc01 ln_ssize01, sig

pwcorr ln_tot_cand_est_nl01 gap_lnexp_est201 prop_fcand_est_nl01 gdppc01 ln_ssize01, sig


******* STACKING THE DATA FOR ALL RACES: requires opening the dataset again later

sort nquest

expand 2, gen(dupli1)

expandcl 3, gen(dupli2) cluster(dupli1)

sort dupli2 nquest

tab dupli2, gen(race)

gen vfemprop=.
replace vfemprop = vfemfed if dupli2==1
replace vfemprop = vfemest if dupli2==2
replace vfemprop = vfemsen_any if dupli2==3
replace vfemprop = vfemgov if dupli2==4
replace vfemprop = vote_fem1 if dupli2==5
replace vfemprop = vote2 if dupli2==6

tab vfemprop

gen select_vfemprop=vfemprop
recode select_vfemprop (0 1=1) (-1=0)

gen plurality = dupli2
recode plurality (1 2=0) (3 4 5 6=1)

* model

probit vfemprop c.information01 c.fsexism c.plurality c.information01#c.plurality c.fsexism#c.plurality idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 race2 race3 race4 race5 [pweight=pesopop] if vfemprop!=-1, cluster(state)

margins, at(information01=(0(.1)1) plurality=0)

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Political Information", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(-.05 "-0.5" .00 "0.00" .05 "0.05" .10 "0.10" .15 "0.15" .20 "0.20",nogrid) yline(0, lcolor(black) lpattern(dash)) title(" ", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(prop1)

margins, at(information01=(0(.1)1) plurality=1)

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Political Information", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(.20 "0.20" .30 "0.30" .40 "0.40" .50 "0.50" .60 "0.60" 0.70 "0.70", nogrid) title(" ", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(pluri1)

margins, at(fsexism=(0(.1)1) plurality=0)

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Sexism", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(-.05 "-0.5" .00 "0.00" .05 "0.05" .10 "0.10" .15 "0.15" .20 "0.20", nogrid)  title(" ", color(black) size(large)) yline(0, lcolor(black) lpattern(dash)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(prop2)

margins, at(fsexism=(0(.1)1) plurality=1)

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Sexism", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(.20 "0.20" .30 "0.30" .40 "0.40" .50 "0.50" .60 "0.60" 0.70 "0.70", nogrid) title(" ", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(pluri2)

graph combine prop1.gph prop2.gph, title("Predicted Probability of Vote for Female Candidate" "in Proportional Races (Chamber/Assembly)", color(black) size(large) pos(12)) ysize(6) xsize(10) iscale(1) graphregion(color(white) margin(medium)) saving(prop)

graph export prop.pdf

graph combine pluri1.gph pluri2.gph, title("Predicted Probability of Vote for Female Candidate" "in Plurality Races (Senate/Government/Presidency)", color(black) size(large) pos(12)) ysize(6) xsize(10) iscale(1) graphregion(color(white) margin(medium)) saving(pluri)

graph export pluri.pdf


******* STACKING THE DATA FOR STATE-LEVEL ANALYSIS: requires opening the dataset again later

* expanding dataset

sort nquest

expand 2, gen(dupli)

tab dupli

* recoding variables

* DV

gen vfemprop =.
replace vfemprop = vfemfed if dupli==1
replace vfemprop = vfemest if dupli==0

gen select_vfemprop=vfemprop
recode select_vfemprop (0 1=1) (-1=0)

* number of candidates

gen ln_tot_cand_prop_nl =.
replace ln_tot_cand_prop_nl = ln_tot_cand_fed_nl if dupli==1
replace ln_tot_cand_prop_nl = ln_tot_cand_est_nl if dupli==0
summarize ln_tot_cand_prop_nl
gen ln_tot_cand_prop_nl01 = (ln_tot_cand_prop_nl - r(min))/(r(max) - r(min))

gen tot_cand_prop_nl =.
replace tot_cand_prop_nl = tot_cand_fed_nl if dupli==1
replace tot_cand_prop_nl = tot_cand_est_nl if dupli==0
summarize tot_cand_prop_nl
gen tot_cand_prop_nl01 = (tot_cand_prop_nl - r(min))/(r(max) - r(min))

* gender gap in resources

gen gap_exp_prop2 =.
replace gap_exp_prop2 = gap_exp_fed2 if dupli==1
replace gap_exp_prop2 = gap_exp_est2 if dupli==0
summarize gap_exp_prop2
gen gap_exp_prop201 = (gap_exp_prop2 - r(min))/(r(max) - r(min))

gen gap_lnexp_prop2 =.
replace gap_lnexp_prop2 = gap_lnexp_fed2 if dupli==1
replace gap_lnexp_prop2 = gap_lnexp_est2 if dupli==0
summarize gap_lnexp_prop2
gen gap_lnexp_prop201 = (gap_lnexp_prop2 - r(min))/(r(max) - r(min))

gen prop_fcand_prop_nl =.
replace prop_fcand_prop_nl = prop_fcand_fed_nl if dupli==1
replace prop_fcand_prop_nl = prop_fcand_est_nl if dupli==0
summarize prop_fcand_prop_nl
gen prop_fcand_prop_nl01 = (prop_fcand_prop_nl - r(min))/(r(max) - r(min))

* models

* direct effects

probit vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

* plots

margins, dydx(gap_lnexp_prop201)

margins, at(gap_lnexp_prop201=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Gender Gap in Campaign Resources", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(0.00 "0.00" 0.05 "0.05" .10 "0.10" 0.15 "0.15" .2 "0.20" ,nogrid) title(" ", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(direct1)

margins, dydx(tot_cand_prop_nl01)

margins, at(tot_cand_prop_nl01=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Number of Candidates", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(0.00 "0.00"  0.05 "0.05" .10 "0.10" 0.15 "0.15" .2 "0.20" ,nogrid) title(" ", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(direct2)

graph combine direct1.gph direct2.gph, title("Predicted Probability of Vote for Female Candidate", color(black) size(large) pos(12)) ysize(6) xsize(10) iscale(1) graphregion(color(white) margin(medium)) saving(direct)

graph export direct.pdf

* moderation

probit vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

* plots

margins, dydx(gap_lnexp_prop201) at(information01=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Political Information", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(-.40 "-0.40" -.30 "-0.30" -.20 "-0.20" -.10 "-0.10" 0.00 "0.00" .10 "0.10" 0.20 "0.20",nogrid) yline(0, lcolor(black) lpattern(dash)) title("Gap in Campaign Resources", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(moderation1)

margins, dydx(tot_cand_prop_nl01) at(information01=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Political Information", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(-.40 "-0.40" -.30 "-0.30" -.20 "-0.20" -.10 "-0.10" 0.00 "0.00" .10 "0.10" .20 "0.20",nogrid) yline(0, lcolor(black) lpattern(dash)) title("Number of Candidates", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(moderation2)

margins, dydx(tot_cand_prop_nl01) at(fsexism=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(black) lc(black)) ci1(lcolor(black) msize(vtiny)) ytitle("") xtitle("Sexism", size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2 " " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium) notick) ylabel(-.40 "-0.40" -.30 "-0.30" -.20 "-0.20" -.10 "-0.10" 0.00 "0.00" .10 "0.10" .20 "0.20",nogrid) yline(0, lcolor(black) lpattern(dash)) title("Number of Candidates", color(black) size(large)) yscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(moderation3)

graph combine moderation1.gph moderation2.gph moderation3.gph, title("Marginal Effects on Probability of Vote for Female Candidate", color(black) size(large) pos(12)) ysize(6) xsize(15) iscale(1) graphregion(color(white) margin(medium)) saving(moderation)

graph export moderation.pdf


**** ROBUSTNESS CHECKS FOR STACKED DATA WITH STATE EFFECTS

* controlling for state�s sample size

probit vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 ln_ssize01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

predict residuals_s1, stdp

reg residuals_s1 c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 ln_ssize01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

probit vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 ln_ssize01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

predict residuals_s2, stdp

reg residuals_s2 c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 ln_ssize01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)


* reduced analyses to larger samples

probit vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1 & bigstate2==1, cluster(state)

probit vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1 & bigstate2==1, cluster(state)

* controlling for Dilma vote

* 1st round

probit vfemprop c.information01 c.fsexism vote_fem1 c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

probit vfemprop c.information01 c.fsexism vote_fem1 c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

* 2nd round

probit vfemprop c.information01 c.fsexism vote2 c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

probit vfemprop c.information01 c.fsexism vote2 c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

* placebo model

probit vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.fsexism#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop] if vfemprop!=-1, cluster(state)

* selection models

heckprob vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop], select(select_vfemprop =  c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli) cluster(state)

heckprob vfemprop c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01 c.information01#c.gap_lnexp_prop201 c.information01#c.tot_cand_prop_nl01 c.fsexism#c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli [pweight=pesopop], select(select_vfemprop = c.information01 c.fsexism c.gap_lnexp_prop201 c.tot_cand_prop_nl01  prop_fcand_prop_nl01 gdppc01 idpt idpsdb idpv left center right evangelical catholic urban education01 jobmarket woman age01 socioretro01 pocketretro01 dupli) cluster(state)

*** END OF CODE
